package com.sskj.wechat.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import com.sskj.core.repository.GenericRepository;
import com.sskj.wechat.domain.entity.WeChatMenuEntity;

public interface WeChatMenuRepository extends GenericRepository<WeChatMenuEntity, String> {

	@Query("SELECT r FROM WeChatMenuEntity r " + " where r.parentId is null  order by r.sortNum asc ")
	List<WeChatMenuEntity> findWeChatMenuByParentIdIsNull();

	@Query("SELECT r FROM WeChatMenuEntity r " + " where r.parentId = ?1  order by r.sortNum asc ")
	List<WeChatMenuEntity> findWeChatMenuByParentId(String parentId);

	@Query("SELECT r FROM WeChatMenuEntity r order by  r.parentId ,r.sortNum asc")
	List<WeChatMenuEntity> findAllWeChatMenu();

}
